package au.com.finalconcept.roo.behaviours.test.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import au.com.finalconcept.roo.behaviours.test.domain.Person;

@RequestMapping("/person/**")
@Controller
public class PersonController {

    @RequestMapping(method = RequestMethod.POST, value = "{id}")
    public void post(@PathVariable Long id, ModelMap modelMap, HttpServletRequest request, HttpServletResponse response) {
    }

    @RequestMapping
    public String index() throws InterruptedException {

        Person p;
        
        p = new Person();
        

        p.setFirstname("first name");
        p.setLastname("lastname");
        p.persist();
        
        Thread.sleep(5000);
        
        p.merge();
        
        
        return "person/index";
    }
}
